Page({
  data: {
    imageList:[],
    source: "",
    width: 0,
    height: 0
  },  
  chooseImage: function () {
    var that = this
    wx.chooseImage({
      count: 1,
      sourceType: ['album', 'camera'],
      sizeType: ['original', 'compressed'],      
      success: function (res) {
        console.log(res)
        that.setData({
          imageList: res.tempFilePaths,
          source: res.tempFilePaths
        }),
        wx.getImageInfo({
          src: res.tempFilePaths[0],
          success: function (res) {
            console.log(res.width)
            console.log(res.height)
          }
        })
      }
    })
  },
  previewImage: function (e) {
    var current = e.target.dataset.src
    console.log("current")
    console.log(current)
    wx.previewImage({
      current: current,
      urls: this.data.imageList
    })
  }
})